package shejishiyan;
public class Test {
 public static void main(String[] args) {
     GradeManager manager = new GradeManager();
     // 创建测试数据
     Student stu1 = new Student("001", "张三", "大数据241班");
     Student stu2 = new Student("002", "李四", "大数据241班");
     Student stu3 = new Student("003", "王五", "大数据241班");
     Course course1 = new Course("C001", "Java应用开发技术", 2.0);
     Course course2 = new Course("C002", "大学物理", 4.0);
     // 添加到管理器
     manager.addStudent(stu1);
     manager.addStudent(stu2);
     manager.addStudent(stu3);
     manager.addCourse(course1);
     manager.addCourse(course2);    
     // 添加成绩（包含异常处理）
     try {
         Score score1 = new Score(stu1, course1, 85.5);
         Score score2 = new Score(stu1, course2, 78.0);
         Score score3 = new Score(stu2, course1, 88.5);
         Score score4 = new Score(stu3, course1, 90.5);
         Score score5 = new Score(stu3, course2, 70.0);
         manager.addScore(score1);
         manager.addScore(score2);
         manager.addScore(score3);
         manager.addScore(score4);
         manager.addScore(score5);
     } catch (ScoreOutOfRangeException e) {
         System.out.println("错误: " + e.getMessage());
     }
     
     // 显示所有数据
     manager.showAllData();   
     // 计算GPA
     System.out.println("\n=== GPA计算 ===");
     System.out.println("张三的GPA: " + manager.calculateGPA("001"));
     System.out.println("李四的GPA: " + manager.calculateGPA("002"));
     System.out.println("王五的GPA: " + manager.calculateGPA("003"));
     // 查询课程成绩
     System.out.println("\n=== 课程成绩 ===");
     manager.showCourseScores("C001");	
     manager.showCourseScores("C002");
   }
}